package com.example.moviegroup.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.moviegroup.R;

/**
 * Created by walymin-love on 2015/11/19.
 */
public class Y1YActivity extends Activity implements View.OnClickListener {
    ImageView iv_zhuan,iv_back;
    TextView tv_guize;
    Animation anim;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_y1y);
        initView();
        setListener();
        initData();
    }

    public void initView() {
        iv_zhuan = (ImageView) findViewById(R.id.yao1yao);
        iv_back = (ImageView) findViewById(R.id.yao_back);
        tv_guize = (TextView) findViewById(R.id.tv_guize);
        anim = AnimationUtils.loadAnimation(this,R.anim.xuanzhuan);
        LinearInterpolator lin = new LinearInterpolator();
        anim.setInterpolator(lin);
        anim.setRepeatMode(Animation.REVERSE);
        iv_zhuan.setAnimation(anim);
    }

    public void setListener() {
        tv_guize.setOnClickListener(this);
        iv_back.setOnClickListener(this);
    }

    public void initData() {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        anim.cancel();
    }

    @Override
    protected void onResume() {
        super.onResume();
        anim.start();
    }

    @Override
    protected void onPause() {
        super.onPause();
        anim.cancel();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.yao_back:
                finish();
                break;
            case R.id.tv_guize:
                Intent intent = new Intent(Y1YActivity.this,GuiZeYaoActivity.class);
                startActivity(intent);
                break;
        }
    }

}
